package datatypes;

public class WorkedExam {
	private int id;
	private int idOfExam;
	private String studentsName;
	private String studentsMatrNr;
	private double[] pointsPerExercise;
	private double grade;
	private double[] secondPointsPerExercise;
	private double secondGrade;
	private int correctionState;
	
	public WorkedExam(){
		
	}
	
	
	public WorkedExam(int id, int idOfExam, String studentsName, String studentsMatrNr, double[] pointsPerExercise,  
			double[] pointsPerExerciseSecond, double grade, double secondGrade, int correctionState){
		this.setId(id);
		this.setIdOfExam(idOfExam);
		this.setStudentsName(studentsName);
		this.setStudentsMatrNr(studentsMatrNr);
		this.setPointsPerExercise(pointsPerExercise);
		this.setGrade(grade);
		this.setPointsPerExercise(pointsPerExerciseSecond);
		this.setGrade(secondGrade);
		this.setCorrectionState(correctionState);
	}
	
	
	
	/**
	 * GETTER&SETTERS
	 */
	
	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public int getIdOfExam() {
		return idOfExam;
	}

	public void setIdOfExam(int idOfExam) {
		this.idOfExam = idOfExam;
	}

	public String getStudentsName() {
		return studentsName;
	}

	public void setStudentsName(String studentsName) {
		this.studentsName = studentsName;
	}

	public String getStudentsMatrNr() {
		return studentsMatrNr;
	}

	public void setStudentsMatrNr(String studentsMatrNr) {
		this.studentsMatrNr = studentsMatrNr;
	}

	public double[] getPointsPerExercise() {
		return pointsPerExercise;
	}
	
	public String getPointsPerExerciseString() {
		String pointsArray = "[ ";
		for(int i=0; i<pointsPerExercise.length; i++){
			pointsArray = pointsArray + (i+1) +" => "+pointsPerExercise[i]+"; ";
		}
		pointsArray = pointsArray + " ]";
		
		return pointsArray;
	}
	
	public void setPointsPerExercise(double[] array) {
		this.pointsPerExercise = array;
	}

	/**
	 * @return the secondPointsPerExercise
	 */
	public double[] getSecondPointsPerExercise() {
		return secondPointsPerExercise;
	}


	/**
	 * @param secondPointsPerExercise the secondPointsPerExercise to set
	 */
	public void setSecondPointsPerExercise(double[] secondPointsPerExercise) {
		this.secondPointsPerExercise = secondPointsPerExercise;
	}
	
	public String getSecondPointsPerExerciseString() {
		String pointsArray = "[ ";
		for(int i=0; i<secondPointsPerExercise.length; i++){
			pointsArray = pointsArray + (i+1) +" => "+secondPointsPerExercise[i]+"; ";
		}
		pointsArray = pointsArray + " ]";
		
		return pointsArray;
	}


	public double getGrade() {
		return grade;
	}

	public void setGrade(double grade) {
		this.grade = grade;
	}
	
	public double getSecondGrade() {
		return secondGrade;
	}

	public void setSecondGrade(double secondGrade) {
		this.secondGrade = secondGrade;
	}



	public String getCorrectionStateString() {
		if(this.correctionState == Misc.Variables.CORRECTION_STATE_NONE)
			return Misc.Variables.CORRECTION_STATE_NONE_STRING;
		if(this.correctionState == Misc.Variables.CORRECTION_STATE_FIRST_CORRECTION)
			return Misc.Variables.CORRECTION_STATE_FIRST_CORRECTION_STRING;
		if(this.correctionState == Misc.Variables.CORRECTION_STATE_FIRST_CORRECTION_APPROVED)
			return Misc.Variables.CORRECTION_STATE_FIRST_CORRECTION_APPROVED_STRING;
		if(this.correctionState == Misc.Variables.CORRECTION_STATE_SECOND_CORRECTION)
			return Misc.Variables.CORRECTION_STATE_SECOND_CORRECTION_STRING;
		if(this.correctionState == Misc.Variables.CORRECTION_STATE_SECOND_CORRECTION_APPROVED)
			return Misc.Variables.CORRECTION_STATE_SECOND_CORRECTION_APPROVED_STRING;
		
		return "Not defined!";
	}
	
	public int getCorrectionState() {
		return this.correctionState;
	}
	
	public void setCorrectionState(int correctionState) {
		this.correctionState = correctionState;
	}
}
